<template>
	<div class="base">

		<el-form ref="form" :model="form" label-width="120px">
			<el-form-item label="用户名">
				{{loginUserInfo.username}}
			</el-form-item>
			
			<el-form-item label="昵称">
				{{loginUserInfo.nickname}}
				
			</el-form-item>
			
			<el-form-item label="性别">
				<el-tag>{{userGender}}</el-tag>
			</el-form-item>
			
			<el-form-item label="用户类型">
				<el-tag>{{loginUserInfo.type_name}}</el-tag>
			</el-form-item>

			<el-form-item label="超级管理员">
				<el-switch disabled v-model="loginUserInfo.SuperAdmin"></el-switch>
			</el-form-item>
			
			<el-form-item label="角色权限">
				<el-checkbox-group v-model="form.type">
					<el-checkbox label="美食/餐厅线上活动" name="type"></el-checkbox>
					<el-checkbox label="地推活动" name="type"></el-checkbox>
					<el-checkbox label="线下主题活动" name="type"></el-checkbox>
					<el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
				</el-checkbox-group>
			</el-form-item>
			
			<el-form-item label="特殊资源">
				<el-radio-group v-model="form.resource">
					<el-radio label="线上品牌商赞助"></el-radio>
					<el-radio label="线下场地免费"></el-radio>
				</el-radio-group>
			</el-form-item>
			
			<el-form-item label="注册时间">
				{{loginUserInfo.register_date | turnTime}}
			</el-form-item>
			
			<el-form-item label="注册IP地址">	
				{{loginUserInfo.register_ip}}
			</el-form-item>
			
			<el-form-item label="备注">
				{{loginUserInfo.comment}}
			</el-form-item>

		</el-form>

	</div>
</template>

<script>
	
	import {mapState} from 'vuex'
	
	export default {
		
		computed:{
			
			...mapState(['loginUserInfo']),
			
			// 用户性别计算
			userGender(){
				
				let gender = this.loginUserInfo.gender || 0
				
				let sex = [
					'未知',
					'男性',
					'女性'
				]
				return sex[gender]
				
				
			}
			
			
		},
		
		data() {
			return {
				form: {
					name: '',
					region: '',
					date1: '',
					date2: '',
					delivery: false,
					type: [],
					resource: '',
					desc: ''
				}
			}
		},
		methods: {
			onSubmit() {
				console.log('submit!');
			}
		}
	}
</script>

<style scoped="scoped">
	.base{
		padding: 15px;
	}
</style>
